package com.jishuo.nontax.web.bill;

import com.github.pagehelper.PageHelper;
import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.nontax.bean.vo.IllegalactivityinfoVO;
import com.jishuo.nontax.bfc.service.IllegalactivityinfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @auther dinggaofei
 * @Date 2023/3/3 14:26
 */
@Slf4j
@Controller
@RequestMapping(value = "/bill/illage", name = "交警处罚书单据")
@UserAuthority(menu={"bill/illage/illage","base/basedata/basedata"})
public class IllegalactivityController {

    @Resource
    private IllegalactivityinfoService illegalactivityinfoService;
    private String prefix = "bill/";

    @RequestMapping(value = {"illage", "illage/{page}"}, name = "交警处罚书首页")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "illage" : page);
    }

    @ResponseBody
    @RequestMapping(value = "listIllage", name = "交警处罚书列表")
    public GridResult<IllegalactivityinfoVO> listIllage(IllegalactivityinfoVO illegalactivityinfoVO, Pagination pagination) {
        return new GridResult<>(illegalactivityinfoService.listIllage(illegalactivityinfoVO, pagination));
    }

    @ResponseBody
    @RequestMapping(value = "saveIllage", name = "修改交警处罚书银行信息")

    public BaseResult saveIllage(IllegalactivityinfoVO illegalactivityinfoVO) {
        return illegalactivityinfoService.saveIllage(illegalactivityinfoVO);

    }

    @ResponseBody
    @RequestMapping(value = "getIllage", name = "获取交罚决定书详细信息")
    public BaseResult getIllage(Long iaiid) {
        return new BaseResult(illegalactivityinfoService.getIllage(iaiid));
    }

    @ResponseBody
    @RequestMapping(value = "sendIllage", name = "发送交罚决定书信息")
    public BaseResult sendIllage(@RequestParam List<String> billids, String userpwd, String usercode) {

        return illegalactivityinfoService.sendIllage(billids, userpwd, usercode);
    }

  /*  @ResponseBody
    @RequestMapping(value = "cleanIllage", name = "冲销交罚决定书信息")
    public BaseResult cleanIllage(String billid, String userpsw, String usercode) {
        return illegalactivityinfoService.cleanIllage(billid,userpsw,usercode);

    }*/

    @ResponseBody
    @RequestMapping(value = "updateIllage",name = "更新交罚决定书信息")
    public BaseResult  updateIllage(@RequestParam List<String> billids,String userpwd,String usercode){
        return  illegalactivityinfoService.updateIllage(billids,userpwd,usercode);
    }
    @ResponseBody
    @RequestMapping(value = "illageExport",name = "导出交罚决定书信息")
    public void illageExport(@RequestParam List<String> billids, HttpServletResponse response){
          illegalactivityinfoService.illageExport(billids,response);
    }
}
